package InterfacePersistencia.Agente;


import java.io.FileNotFoundException;

import InterfaceGrafica.Tabela;
import InterfacePersistencia.conexao.MessageTreat;
import InterfacePersistencia.conexao.MyPop3;
import preProcessingMenssage.PreProcessingMessage;
import classificacao.NBayes;
import padroes.*;

/*
 * Agent.java
 *
 * Created on 30 de Abril de 2007, 18:12
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

/**
 *
 * @author Matheus Cardoso
 *Classe que chama a classe TrayIconAgent e consquentemente todo o programa
 */
public class Agent {

    private static Agent singleinstance = null;

    private Agent() throws FileNotFoundException {

        //trayIconAgent.SetTray();

        MyPop3 conection = new MyPop3();
        MessageTreat messageTreat = new MessageTreat();
        conection.addMimeObservers(messageTreat);
        
        PreProcessingMessage preProcessador = new PreProcessingMessage();
        messageTreat.addObservers(preProcessador);

       // TestClass teste = new TestClass(); //CLASSE DE TESTE
        NBayes classificador = new NBayes();
        preProcessador.addObservers(classificador);
        //classificador.addObservers(teste);
        
        Tabela tabela = new Tabela(classificador);
        classificador.addObservers(tabela);
    	
        TrayIconAgent trayIconAgent = new TrayIconAgent(conection);

    }

    static Agent getSingleton() throws FileNotFoundException {
        if (singleinstance != null) {
            return singleinstance;
        } else {
            return new Agent();
        }
    }

    public static void main(String[] args) throws FileNotFoundException {
        Agent.getSingleton();

    }
}
